<template>
  <div class="header-view">
    <div class="go-back" @click="$store.getters.isBack ? goBack() : ''">
      <van-icon
        class="arrow-icon"
        v-if="$store.getters.isBack"
        name="arrow-left"
      />
    </div>
    <div class="title">
      <div class="title-text">{{ $store.getters.headerTitle }}</div>
    </div>
    <div class="right"></div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  watch: {},
  computed: {},
  data() {
    return {};
  },
  created() {},
  mounted() {},
  methods: {
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="scss" scoped>
.header-view {
  height: 50px;
  background-color: #fff;
  display: flex;
  .go-back {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 50px;
    .arrow-icon {
      color: #ccc;
      font-size: 26px;
    }
  }
  .title {
    flex: 1;
    position: relative;
    .title-text {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 16px;
      font-weight: bold;
    }
  }
  .right {
    width: 50px;
  }
}
</style>